from django.urls import path, include
from web.views import account, home, project, statistics, wiki, file, setting, issues, dashboard, game, datacrwal

urlpatterns = [
    path('register/', account.register, name='register'),
    path('login_sms/', account.login_sms, name='login_sms'),
    path('login/', account.login, name='login'),
    path('image/code/', account.image_code, name='image_code'),
    path('send_sms/', account.send_sms, name='send_sms'),
    path('index/', home.index, name='index'),
    path('logout/', account.logout, name='logout'),
    path('price/', home.price, name='price'),
    path('game/info', game.game_info, name='game_info'),
    path('game/num', game.game_num, name='game_num'),
    path('payment/<int:policy_id>/', home.payment, name='payment'),
    path('pay/<int:policy_id>/', home.pay, name='pay'),
    path('pay/notify/', home.pay_notify, name='pay_notify'),
    path('trade/order/', home.trade_order, name='trade_order'),
    path('delete_order/', home.delete_order, name='delete_order'),
    path('trade/pay/<int:policy_id>', home.trade_pay, name='trade_pay'),

    # 个人管理中心路由
    path('project_list/', project.project_list, name='project_list'),
    # 星标项目，project/star/my/1
    # project/star/join/1
    path('project/star/<str:project_type>/<str:project_id>/', project.project_star, name='project_star'),
    # 取消星标
    path('project/unstar/<str:project_type>/<str:project_id>/', project.unproject_star, name='unproject_star'),

    path('manage/<int:project_id>/', include([

        path('wiki/', wiki.wiki, name='wiki'),
        path('wiki_catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        path('wiki_add/', wiki.wiki_add, name='wiki_add'),
        path('wiki_del/<int:wiki_id>/', wiki.wiki_del, name='wiki_del'),
        path('wiki_edit/<int:wiki_id>/', wiki.wiki_edit, name='wiki_edit'),
        path('wiki_upload/', wiki.wiki_upload, name='wiki_upload'),
        path('file/', file.file, name='file'),
        path('file_delete/', file.file_delete, name='file_delete'),

        path('cos_credentials/', file.cos_credentials, name='cos_credentials'),

        path('file_post/', file.file_post, name='file_post'),

        path('file_download/<int:file_id>/', file.file_download, name='file_download'),

        path('settings/', setting.setting, name='settings'),
        path('delete_item/', setting.delete_item, name='delete_item'),

        path('issues/', issues.issues, name='issues'),
        path('issues_detail/<int:issues_id>/', issues.issues_detail, name='issues_detail'),
        path('issues_record/<int:issues_id>/', issues.issues_record, name='issues_record'),
        path('issues_change/<int:issues_id>/', issues.issues_change, name='issues_change'),
        path('invite_url/', issues.invite_url, name='invite_url'),
        path('dashboard/', dashboard.dashboard, name='dashboard'),
        path('issues_chart/', dashboard.issues_chart, name='issues_chart'),
        path('statistics/', statistics.statistics, name='statistics'),
        path('statistics/priority', statistics.statistics_priority, name='statistics_priority'),
        path('project/user', statistics.project_user, name='project_user'),
        path('data_crawl/', datacrwal.data_crawl, name='data_crawl'),
        path('keyword_crawl/', datacrwal.keywordcrawl, name="keyword_crawl")

    ], None)),
    path('invite_join/<str:code>/', issues.invite_join, name='invite_join'),

]
